package com.example.servicelifecycle;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class LifecycleService extends Service {
    private static final String TAG = LifecycleService.class.getSimpleName();
    public LifecycleService() {
    }
    @Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "onCreate: 服务被创建");
    }
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i(TAG, "onStartCommand: 服务启动");
        return super.onStartCommand(intent, flags, startId);
    }
    @Override
    public IBinder onBind(Intent intent) {
        Log.i(TAG, "onBind: 服务被绑定");
        return null;
    }
    @Override
    public void onRebind(Intent intent) {
        super.onRebind(intent);
        Log.i(TAG, "onRebind: 服务被再次绑定");
    }
    @Override
    public boolean onUnbind(Intent intent) {
        Log.i(TAG, "onUnbind: 服务解绑");
        return true;
    }
    @Override
    public void onDestroy() {
        Log.i(TAG, "onDestroy: 服务被销毁");
        super.onDestroy();
    }
}